# 钉钉通知工具
import requests
from tests.utils.log_utils import LogUtils

logger = LogUtils.get_logger()


class DingTalkUtils:
    def __init__(self):
        self.webhook = "https://oapi.dingtalk.com/robot/send?access_token=your_token"

    def send_message(self, message):
        """发送钉钉通知"""
        headers = {
            "Content-Type": "application/json",
            "Charset": "UTF-8"
        }
        data = {
            "msgtype": "text",
            "text": {
                "content": message
            }
        }
        response = requests.post(self.webhook, headers=headers, json=data)
        logger.info(f"钉钉通知发送结果: {response.json()}")
